package com.glsc.ngateway.common.base.repo.mysql.gateway.other;

import com.glsc.ngateway.common.base.domain.mysql.gateway.other.TradeAccountFurture;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface TradeAccountFurtureRepository extends JpaRepository<TradeAccountFurture, Integer>, JpaSpecificationExecutor<TradeAccountFurture> {
    @Query(value = "select m from TradeAccountFurture m where m.dataStatus=0 " +
//            "and (:#{#paramSearchDto.shareHolderAccount} is null OR m.shareHolderAccount = :#{#paramSearchDto.shareHolderAccount})  " +
//            "and (:#{#paramSearchDto.shareHolderAccountName} is null OR m.shareHolderAccountName = :#{#paramSearchDto.shareHolderAccountName})  " +
            "and (:#{#paramSearchDto.futureCompany} is null OR m.futureCompany LIKE CONCAT('%',:#{#paramSearchDto.futureCompany},'%') )  " +
            "and (:#{#paramSearchDto.teamName} is null OR m.teamName LIKE CONCAT('%',:#{#paramSearchDto.teamName},'%') )  " +
            "and (:#{#paramSearchDto.futureCompanyMoneyAccount} is null OR m.futureCompanyMoneyAccount LIKE CONCAT('%',:#{#paramSearchDto.futureCompanyMoneyAccount},'%') )  " +
            "and (:#{#paramSearchDto.futureType} is null OR m.futureType LIKE CONCAT('%',:#{#paramSearchDto.futureType},'%') )  " +
            "and (:#{#paramSearchDto.settlementAccount} is null OR m.settlementAccount LIKE CONCAT('%',:#{#paramSearchDto.settlementAccount},'%') )  " +
            "and (:#{#paramSearchDto.openAccountDate} is null OR m.openAccountDate LIKE CONCAT('%',:#{#paramSearchDto.openAccountDate},'%') )  " +
            "and (:#{#paramSearchDto.tradeCode} is null OR m.tradeCode LIKE CONCAT('%',:#{#paramSearchDto.tradeCode},'%') )  " +
            "and (:#{#paramSearchDto.futureUseDepartmentId} is null OR m.futureUseDepartmentId = :#{#paramSearchDto.futureUseDepartmentId})  " +
//            "and (:#{#paramSearchDto.futureUseDepartmentId} is null OR m.futureUseDepartmentId LIKE CONCAT('%',:#{#paramSearchDto.futureUseDepartmentId},'%') )  " +
            "and (:#{#paramSearchDto.teamNameSelectName} is null OR m.teamNameSelectName LIKE CONCAT('%',:#{#paramSearchDto.teamNameSelectName},'%') )  " +
            "and (:#{#paramSearchDto.futureTypeSelectName} is null OR m.futureTypeSelectName LIKE CONCAT('%',:#{#paramSearchDto.futureTypeSelectName},'%') )  " +
            "and (:#{#paramSearchDto.settlementAccountSelectName} is null OR m.settlementAccountSelectName LIKE CONCAT('%',:#{#paramSearchDto.settlementAccountSelectName},'%') )  " +
            "AND (:#{#paramSearchDto.openDate} is null OR m.openDate LIKE CONCAT('%',:#{#paramSearchDto.openDate},'%'))" +
//            "and (:#{#paramSearchDto.shareHolderAccountName} is null OR m.shareHolderAccountName LIKE CONCAT('%',:#{#paramSearchDto.shareHolderAccountName},'%') )  " +
//            "and (:#{#paramSearchDto.market} is null OR m.market = :#{#paramSearchDto.market})  " +
//            "and (:#{#paramSearchDto.status} is null OR m.status = :#{#paramSearchDto.status})  " +
//            "and (:#{#paramSearchDto.shareHolderUseDepartment} is null OR m.shareHolderUseDepartment = :#{#paramSearchDto.shareHolderUseDepartment})  " +
//            "and (:#{#paramSearchDto.belongDeptId} is null OR m.belongDeptId = :#{#paramSearchDto.belongDeptId})  " +
//            "and (:#{#paramSearchDto.opSupportName} is null OR m.opSupportName LIKE CONCAT('%',:#{#paramSearchDto.opSupportName},'%') )  " +
//            "and (:#{#paramSearchDto.systemSummary} is null OR m.systemSummary LIKE CONCAT('%',:#{#paramSearchDto.systemSummary},'%') )  " +
//            "and (:#{#paramSearchDto.processDefineKey} is null OR m.processDefineKey = :#{#paramSearchDto.processDefineKey} )  " +
//            "and (:#{#paramSearchDto.systemCode} is null OR m.systemCode = :#{#paramSearchDto.systemCode} )  " +
//            "and (:#{#paramSearchDto.beginDateLocalDate} is null OR m.processCreateTime >= :#{#paramSearchDto.beginDateLocalDate} )  " +
//            "and (:#{#paramSearchDto.endDateLocalDate} is null OR m.processCreateTime <= :#{#paramSearchDto.endDateLocalDate} )  " +
//            "and (:#{#paramSearchDto.hasProcessEnd} is null OR m.isClose = :#{#paramSearchDto.hasProcessEnd} )  " +
//            "and (coalesce(:#{#paramSearchDto.adminList}, null) is null or m.systemAdminAccount in (:#{#paramSearchDto.adminList})) " +
            "")
    Page<TradeAccountFurture> searchByParam(Pageable pageable, TradeAccountFurture paramSearchDto);
}



